package com.eco.fanliapp.job;

import com.eco.fanliapp.service.IJobService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;

/**
 * 实现序列化接口、防止重启应用出现quartz Couldn't retrieve job because a required class was not found 的问题
 */
@Slf4j
public class TestJob implements  Job,Serializable {

	private static final long serialVersionUID = 1L;
	   
    @Autowired
    private IJobService jobService;
    
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		log.info(jobService.toString());
		log.info("任务执行成功-TestJob:"+"quzrtz-cluster-node-second");
	}
}
